home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* novell.c 06/19/86 */
- /* */
- /* this is a collection of Novell Network System calls */
- /* */
- /****************************************************************/
-
- #include <dos.h>
- union REGS inregs, outregs;
- struct SREGS segregs;
-
- static char request[128], response[128];
-
- seteoj(flag)
- int flag;
- {
- inregs.h.ah = 0xbb;
- inregs.h.al = flag;
- intdos(&inregs, &outregs);
- return(0);
- }
-
- getusr()
- {
- inregs.h.ah = 0xdc;
- intdos(&inregs, &outregs);
- return(outregs.h.al);
- }
-
- brdcast(num_stations, station_list, message)
- int num_stations;
- char *station_list;
- char *message;
- {
- int i;
-
- request[2] = 0;
- request[3] = num_stations;
- for (i=0; i<num_stations; i++) {
- request[i+4] = *(station_list+i);
- }
- for (i=0; *(message+i) != '\0'; i++) {
- request[num_stations + 5 + i] = message[i];
- }
- request[num_stations + 4] = i;
- request[0] = 3 + num_stations + i;
-
- inregs.h.ah = 0xe1;
- segread(&segregs);
- inregs.x.si = (unsigned) (request);
- inregs.x.di = (unsigned) (response);
- intdosx(&inregs, &outregs, &segregs);
-
- for (i=0; i<num_stations; i++) {
- station_list[i] = response[i+3];
- }
- return(0);
- }
-
- pipopen(num_stations, station_list)
- int num_stations;
- char *station_list;
- {
- int i;
-
- for (i=0; i<num_stations; i++) {
- request[i+4] = *(station_list+i);
- }
- request[0] = 2 + num_stations;
- request[2] = 6;
- request[3] = num_stations;
-
- response[0] = 1 + num_stations;
-
- inregs.h.ah = 0xe1;
- segread(&segregs);
- inregs.x.si = (unsigned) (request);
- inregs.x.di = (unsigned) (response);
- intdosx(&inregs, &outregs, &segregs);
-
- for (i=0; i<num_stations; i++) {
- station_list[i] = response[i+3];
- }
- return(0);
- }
-
- pipclose(num_stations, station_list)
- int num_stations;
- char *station_list;
- {
- int i;
-
- for (i=0; i<num_stations; i++) {
- request[i+4] = *(station_list+i);
- }
- request[0] = 2 + num_stations;
- request[2] = 7;
- request[3] = num_stations;
-
- response[0] = 1 + num_stations;
-
- inregs.h.ah = 0xe1;
- segread(&segregs);
- inregs.x.si = (unsigned) (request);
- inregs.x.di = (unsigned) (response);
- intdosx(&inregs, &outregs, &segregs);
-
- for (i=0; i<num_stations; i++) {
- station_list[i] = response[i+3];
- }
- return(0);
- }
-
- pipread(message)
- char *message;
- {
- int i, j;
-
- request[0] = 1;
- request[2] = 5;
-
- response[0] = 126;
-
- inregs.h.ah = 0xe1;
- segread(&segregs);
- inregs.x.si = (unsigned) (request);
- inregs.x.di = (unsigned) (response);
- intdosx(&inregs, &outregs, &segregs);
-
- j = (int) response[0];
- for (i=0; i<j; i++) {
- message[i] = response[i+2];
- }
- return(0);
- }
-
- pipwrite(num_stations, station_list, message)
- int num_stations;
- char *station_list;
- char *message;
- {
- int i;
-
- request[2] = 4;
- request[3] = num_stations;
- for (i=0; i<num_stations; i++) {
- request[i+4] = *(station_list+i);
- }
- for (i=0; *(message+i) != '\0'; i++) {
- request[num_stations + 5 + i] = message[i];
- }
- request[num_stations + 4] = i;
- request[0] = 3 + num_stations + i;
-
- inregs.h.ah = 0xe1;
- segread(&segregs);
- inregs.x.si = (unsigned) (request);
- inregs.x.di = (unsigned) (response);
- intdosx(&inregs, &outregs, &segregs);
-
- for (i=0; i<num_stations; i++) {
- station_list[i] = response[i+3];
- }
- return(0);
- }
-
- semopen(name, value, handle, users)
- char *name;
- int value;
- unsigned long *handle;
- int *users;
- {
- int i;
-
- for (i=0; *(name+i) != '\0'; i++) {
- request[i+1] = *(name+i);
- }
- request[0] = i;
-
- inregs.h.ah = 0xc5;
- inregs.h.al = 0x00;
- inregs.h.cl = value;
- inregs.x.dx = (unsigned) (request);
- intdos(&inregs, &outregs);
- *handle = ((long) outregs.x.dx << 16) + outregs.x.cx;
- *users = outregs.h.bl;
- return(outregs.h.al);
- }
-
- semexam(handle, value, users)
- unsigned long handle;
- int *value;
- int *users;
- {
- inregs.h.ah = 0xc5;
- inregs.h.al = 0x01;
- inregs.x.cx = handle & 0xffff;
- inregs.x.dx = handle >> 16;
- intdos(&inregs, &outregs);
- *value = outregs.x.cx;
- *users = outregs.h.dl;
- return(outregs.h.al);
- }
-
- semwait(handle, timout)
- unsigned long handle;
- int timout;
- {
- inregs.h.ah = 0xc5;
- inregs.h.al = 0x02;
- inregs.x.cx = handle & 0xffff;
- inregs.x.dx = handle >> 16;
- /*
- inregs.x.bp = timout;
- */
- intdos(&inregs, &outregs);
- return(outregs.h.al);
- }
-
- semsig(handle)
- unsigned long handle;
- {
- inregs.h.ah = 0xc5;
- inregs.h.al = 0x03;
- inregs.x.cx = handle & 0xffff;
- inregs.x.dx = handle >> 16;
- intdos(&inregs, &outregs);
- return(outregs.h.al);
- }
-
- semclose(handle)
- unsigned long handle;
- {
- inregs.h.ah = 0xc5;
- inregs.h.al = 0x04;
- inregs.x.cx = handle & 0xffff;
- inregs.x.dx = handle >> 16;
- intdos(&inregs, &outregs);
- return(outregs.h.al);
- }